package com.zg.autoform.enm;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/1/20 15:08
 */

public enum ViewTypeEnum {
    LIST("列表"),
    ADD("新增"),
    UPDATE("修改"),
    INFO("详情");
    private String cn;


    public String getCn(){
        return this.cn;
    }

    ViewTypeEnum( String cn) {
        this.cn = cn;
    }

    public static String getCnByCode(String name) {
        if (null != name) {
            for (ViewTypeEnum enumItem : ViewTypeEnum.values()) {
                if (enumItem.name().equals(name)) {
                    return enumItem.getCn();
                }
            }
        }
        return "";
    }

    public static ViewTypeEnum toEnum(String name) {
        if (null != name) {
            for (ViewTypeEnum e : ViewTypeEnum.values()) {
                if (e.name().equals(name)) {
                    return e;
                }
            }
        }
        return null;
    }
}
